<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> 
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>代理信息编辑查看</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<link rel="stylesheet" href="../css/admin_style.css" />
<script type="text/javascript" src="../js/core/core.js"></script>
<script type="text/javascript" src="../js/pagination.js"></script>
<script language="javascript" src="../js/validate.js"></script>    
</head>
<body>
<div class="wrap">
<div class="nav3 mb10">
	<ul class="cc">
		<li><a href="userManagerUI?currentPage=1">代理管理</a></li>
		<li class="current"><a href="toAddUser">添加代理</a></li>
    </ul>
</div>
<div class="admin_info mb10">
	<h3 class="h1"><b>提示信息</b></h3>
	<div class="legend">主要功能:代理添加</div>
</div>
<form action="addUser" method="post"  onsubmit="return submitForm(this);">
<h2 class="h1"><b>代理编辑查看</b></h2>
<div class="admin_table mb10">
<table>
<tbody>
<tr class="tr1 vt">
    <td class="td1">登陆帐号：</td>
    <td class="td2"><input class="input input_wa" name="wm.userAccount" id="wm.account" type="text" value="" size="35" minLength="3" maxlength="20" validate="登陆帐号||notnull,minLength,maxlength">*      
    </td>
</tr>
<tr class="tr1 vt">
    <td class="td1">QQ号码：</td>
    <td class="td2"><input class="input input_wa" name="wm.qq" type="text" id="wm.qq" value="" size="35" maxlength="20" validate="QQ号码||notnull,integer">*</td>
</tr>    
<tr class="tr1 vt">
    <td class="td1">手机：</td>
    <td class="td2"><input class="input input_wa" name="wm.phone" type="text" id="wm.mobile" value="" size="35" minLength="11" maxlength="11"></td>
</tr>
<tr class="tr1 vt">
    <td class="td1">旺旺：</td>
    <td class="td2"><input class="input input_wa" name="wm.wangwang" type="text" id="wm.ww" value="" minLength="11" maxlength="11"></td>
</tr>
</table>
<h2 class="h1"><b>登录密码</b></h2>
<table>
<tr class="tr1 vt">
    <td class="td1">登陆密码：</td>
    <td class="td2"><input class="input input_wa" name="wm.userPassword" type="password" id="wm.password" value="" size="35" minLength="6" maxlength="20">
        必须是数字和字母(6-20位)！
    </td>
</tr>
<sec:authorize ifAnyGranted="ROLE_ROOT">
<tr class="tr1 vt">
    <td class="td1">人员类型：</td>
    <td class="td2">
    	<input type="radio" name="userType" value="0" checked="checked"/>管理人员&nbsp;&nbsp;
    	<input type="radio" name="userType" value="1" />审核人员
    </td>
</tr>
</sec:authorize>
</table>
</div>
<div class="tac mb10">
	<span class="btn"><span><button type="submit">提 交</button></span></span>
	<span class="btn"><span><button type="button" onclick="history.go(-1);">返 回</button></span></span>
</div>
</form>
<div class="c"></div>
</div>

<script type="text/javascript" src="../js/global.js"></script>
<script type="text/javascript" src="../js/pw_ajax.js"></script>
<script type="text/javascript" src="../js/admin.js"></script>
<script type="text/javascript" src="../js/date.js"></script>
<script type="text/javascript" src="../js/plugin.js"></script>
<script type="text/javascript">
function showConfirm(info,href){
 info = info ;//+ "<br>操作理由：<input type='text' id='____operationReason'><br>操作密匙：<input type='text' id='____operationPassword'>";
 showDialog({type:"confirm",message:info,onOk:function(){
   //var ____operationReason=document.getElementById("____operationReason").value;
   //if(!____operationReason || ____operationReason==""){alert("请输入操作理由");return false;}
   location.href=href;
   //openNewUrl('user'+new Date().getTime(),info,href);
   return true;
 }});
}
var operations=document.getElementsByTagName("a");
for(var i=0;i<operations.length;i++){
    var obj=operations[i];
    var confirm=obj.getAttribute("confirm");
    if(!confirm || confirm!="yes")continue;
    obj.attachEvent("onclick",function(e){
        e=window.event||e;
        var el=e.srcElement;
        //test();
        if(el.href.indexOf("javascript:void")==-1)
        el.href="javascript:void(0);showConfirm('"+"确认执行"+el.innerText+"操作？！"+"','"+el.href+"');"
        return false;
    })
}

var allInputs = document.getElementsByTagName('input');
if(allInputs && allInputs.length>0){
	for(var i=0; i<allInputs.length;i++)
	{
		var ipt = allInputs[i].parentNode;
		if(ipt.tagName=='LI'&& allInputs[i].type=='radio')
		{
			allInputs[i].checked && (ipt.className='current');
			ipt.onclick = function(){radioWithWords(this)};
		}
	}
}
</script>
<script type="text/javascript">
    if (typeof (HTMLElement) != "undefined" && !window.opera) {
    HTMLElement.prototype.__defineGetter__("outerHTML", function () {
        var a = this.attributes, str = "<" + this.tagName, i = 0; for (; i < a.length; i++)
            if (a[i].specified)
                str += " " + a[i].name + '="' + a[i].value + '"';
        if (!this.canHaveChildren)
            return str + " />";
        return str + ">" + this.innerHTML + "</" + this.tagName + ">";
    });
    HTMLElement.prototype.__defineSetter__("outerHTML", function (s) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var df = r.createContextualFragment(s);
        this.parentNode.replaceChild(df, this);
        return s;
    });
    HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
        return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
    });
}
if (typeof (HTMLElement) != "undefined" && !window.opera) {
    HTMLElement.prototype.__defineGetter__("outerHTML", function () {
        var a = this.attributes, str = "<" + this.tagName, i = 0; for (; i < a.length; i++)
            if (a[i].specified)
                str += " " + a[i].name + '="' + a[i].value + '"';
        if (!this.canHaveChildren)
            return str + " />";
        return str + ">" + this.innerHTML + "</" + this.tagName + ">";
    });
    HTMLElement.prototype.__defineSetter__("outerHTML", function (s) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var df = r.createContextualFragment(s);
        this.parentNode.replaceChild(df, this);
        return s;
    });
    HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
        return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
    });
}
</script>
<script type="text/javascript">
    var valueControls={//能直接用 obj.value赋值的控件名及Type
        "input":"text,password,hidden",
        "select":"select-one",
        "textarea":"textarea"
    };
    
    var formData={};
    for(var id in formData){//铺数据
      var obj=document.getElementById(id);
      if(id && obj){//checkBox
        var tagName=obj.tagName.toLowerCase();
        if(obj.type){
          var type=obj.type.toLowerCase();
          if(valueControls[tagName] && valueControls[tagName].indexOf(type)!=-1){
            if(eval("document.getElementById(\""+id+"\")")){
              document.getElementById(id).value=formData[id];
            }
          }else{
             if(type=="radio" || type=="checkbox"){
              initRadioOrCheckBox(id); 
             }
             if(type=="select-multiple"){
              initMultiSelect(id);
             }
          }
        }else{
           obj.innerHTML=formData[id]; 
        }
      }
    }
    function initRadioOrCheckBox(id){
      var servingTimes=document.getElementsByName(id);
      for(var s=0;s<servingTimes.length;s++){
         if(servingTimes[s].type=="checkbox")
           servingTimes[s].checked=false;
      }
      if(formData[id]){
        var servingTimesValue=formData[id].split(",");
        for(var s=0;s<servingTimesValue.length;s++){
         for(var i=0;i<servingTimes.length;i++){
            if(servingTimes[i].value==servingTimesValue[s].trim())
            servingTimes[i].checked=true;
         }
       }
      }else{
       for(var i=0;i<servingTimes.length;i++){
         if(servingTimes[i].type=="checkbox")
           servingTimes[i].checked=true;
       }
      }
   }
   function initMultiSelect(id){
      var selOptions=document.getElementById(id).options;
      for( var i=0;i<selOptions.length;i++){
         selOptions.selected=false;
      }
      if(formData[id]){
        var selOptionsValue=formData[id].split(",");
        for(var s=0;s<selOptionsValue.length;s++){

         for(var i=0;i<selOptions.length;i++){
            if(selOptions[i].value==selOptionsValue[s].trim())
            selOptions[i].selected=true;
         }
       }
      }else{
       for(var i=0;i<selOptions.length;i++){
         selOptions[i].selected=false;
       }
      }
   }
</script>    
<script type="text/javascript">
function getQueryString(form,param) {
        var datastring = '';
        var inputs = form.getElementsByTagName('INPUT');
        for (var i = 0; i < inputs.length; i++) {
            if(inputs[i].name==param)continue;
            
            switch (inputs[i].getAttribute('type')) {
                case 'text':
                    datastring = plamostr(inputs[i], datastring);
                    break;
                case 'hidden':
                    datastring = plamostr(inputs[i], datastring);
                    break;
                case 'checkbox':
                    if (inputs[i].checked) {
                        datastring = plamostr(inputs[i], datastring);
                    }
                    break;
                case 'radio':
                    if (inputs[i].checked) {

                        datastring = plamostr(inputs[i], datastring);
                    }
                    break;
            }
        }
        var textareas = form.getElementsByTagName('TEXTAREA');
        for (var i = 0; i < textareas.length; i++) {
            datastring = plamostr(textareas[i], datastring);
        }
        var selectes = form.getElementsByTagName('SELECT');
        for (var i = 0; i < selectes.length; i++) {
            datastring = plamostr(selectes[i], datastring);
        }
        if(param){
            document.getElementById(param).value=datastring;
        }
        return datastring;
    }
    function plamostr(object, datastring) {
        /**
         *拼装Form数据字符串
         */
        if (datastring.length > 0) {
            datastring += '&' + object.getAttribute('name') + '=' + object.value;
        } else {
            datastring += object.getAttribute('name') + '=' + object.value;
        }
        return datastring;
    }
</script><script type="text/javascript">
     function submitForm(form){
       if(!frmSubmit(form))return false;
       var account=document.getElementById("wm.account");
       var password=document.getElementById("wm.password");
       if(account.length<2){alert("帐号名过短，长度必须大于2！");}
       if(password.length<6){alert("密码过短，长度必须大于等于6！");}
      return true;
    }
</script>
</body></html>

